﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication3
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LabelTime.Text = DateTime.Now.ToShortDateString();

                DropDownListSource.Items.AddRange(new ListItem[] {
                    new ListItem("新华网"),
                    new ListItem("人民网"),
                    new ListItem("网易新闻"),
                });
            }
        }

        protected void BtnSubmint_Click(object sender, EventArgs e)
        {
            if (tbxNews.Text == "")
            {
                Response.Write("<script>alert('请输入新闻内容');</script>");
                return;
            }

            Response.Write("<script>alert('发布成功');</script>");
        }

        protected void BtnClear_Click(object sender, EventArgs e)
        {
            tbxNews.Text = "";
            DropDownListSource.SelectedIndex = 0;
        }
    }
}